<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: qrcode.inc.php 34684 2014-07-07 07:27:56Z nemohou $
 */
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}

$dir = DISCUZ_ROOT.'./source/plugin/xigua_wsq/cache/';

$_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);

dheader('Expires: '.gmdate('D, d M Y H:i:s', TIMESTAMP + 86400).' GMT');
require_once DISCUZ_ROOT . './source/plugin/wechat/wsq.class.php';
$url = $_GET['url'];

$qrsize = 3;
$filename = md5($url).'.jpg';
$file = $dir.$filename;
if(!file_exists($file) || !filesize($file)) {
    dmkdir($dir);
    require_once DISCUZ_ROOT.'source/plugin/mobile/qrcode.class.php';
    QRcode::png($url, $file, QR_ECLEVEL_Q, $qrsize);
}
dheader('Content-Disposition: inline; filename='.$filename);
dheader('Content-Type: image/pjpeg');
@readfile($file);
exit;